package com.wngbms.feigndemo.controller;

import com.wngbms.feigndemo.feign.CaseFeign;
import com.wngbms.feigndemo.vo.BaseResp;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@Slf4j
@RestController
@RequestMapping("/trigger")
public class CaseFeignTriggerController {

    @Autowired
    CaseFeign caseFeign;

    @PostMapping("/formData1")
    public BaseResp formData1(@RequestParam String name, @RequestParam String password) {
        return caseFeign.formData1(name, password);
    }

    @PostMapping("/formData2")
    public BaseResp formData2(@RequestPart("image") MultipartFile file) {
        log.info("file:{}", file.getOriginalFilename());
        return caseFeign.formData2(file);
    }

    @PostMapping("/formData3")
    public BaseResp formData3(@RequestParam String name, @RequestPart("image") MultipartFile file) {
        return caseFeign.formData3(name, file);
    }

    @PostMapping("/formData4")
    public BaseResp formData4(@RequestParam String name, @RequestParam String password) {
        return caseFeign.formData4(name, password);
    }

    @PostMapping("/formData5")
    public BaseResp formData5(@RequestParam String name, @RequestParam String password) {
        return caseFeign.formData5(name, password);
    }

    @PostMapping("/formData6")
    public BaseResp formData6(@RequestBody String name) {
        log.info("body:{}", name);
        return caseFeign.formData6(name);
    }

    @PostMapping("/formData7")
    public BaseResp formData7(@RequestBody String name) {
        log.info("body:{}", name);
        return caseFeign.formData7(name);
    }

    @PostMapping("/formData8")
    public BaseResp formData8(@RequestBody String name) {
        log.info("body:{}", name);
        return caseFeign.formData8(name);
    }

    @PostMapping("/formData9")
    public BaseResp formData9(@RequestBody String name) {
        log.info("body:{}", name);
        return caseFeign.formData9(name);
    }

    @PostMapping("/formData10")
    public BaseResp formData10(@RequestBody String name) {
        log.info("body:{}", name);
        return caseFeign.formData10(name);
    }
}
